package com.syx.friend.Controller.user;

import com.syx.api.Model.VO.UserQuestionResultVO;
import com.syx.commoncore.Model.Result;
import com.syx.commoncore.Model.TableDataInfoResult;
import com.syx.friend.Aop.CheckUserStatus;
import com.syx.friend.Model.exam.DTO.ExamRankDTO;
import com.syx.friend.Model.user.DTO.UserSubmitDTO;
import com.syx.friend.Service.IExamService;
import com.syx.friend.Service.IUserQuestionService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user/question")
public class UserQuestionController {

    @Resource
    IUserQuestionService iUserQuestionService;


    @Resource
    IExamService iExamService;



    //用户代码提交，进行判题功能开发
    @CheckUserStatus
    @PostMapping("/submit")
    public Result<UserQuestionResultVO> submit(@RequestBody UserSubmitDTO userSubmitDTO){
        //提交用户答题内容
        return iUserQuestionService.submit(userSubmitDTO);


    }
    @CheckUserStatus
    @PostMapping("/rabbit/submit")
    public Result<Void> rabbitSubmit(@RequestBody UserSubmitDTO userSubmitDTO){
        //提交用户答题内容
        if (iUserQuestionService.rabbitSubmit(userSubmitDTO)){
            return Result.success();
        }
        return Result.failure();



    }
    @CheckUserStatus
    @GetMapping("exe/result")
    public Result<UserQuestionResultVO> exeResult(Long examId,Long questionId,String currentTime){
        return iUserQuestionService.exeResult(examId,questionId,currentTime);



    }


}
